<?php

declare (strict_types = 1);

namespace app\common\model;

use think\Model;

class BaseModel extends Model
{
    protected $readonly = ['create_time'];

    protected static function onBeforeInsert($model): void
    {
        // 新增数据前强制清除创建时间和更新时间
        unset($model->create_time);
        if (property_exists($model, 'update_time')) {
            unset($model->update_time);
        }
    }
}